$(function () {
    //======================
    //======设置查询条件========
    //======================
    //内部公司
    $("#wlygyswl_toolbar [name='gsId']").gsjgtree(1);


//======================
//========统计列表========
//======================
    var columns = [
        [
            {title: '业务', colspan: 5, width: 100},
            {title: '财务', colspan: 4, width: 100}
        ],
        [
            {field: 'gsname', title: '园区', width: 100, align: 'right'},
            {field: 'custname', title: '供应商', width: 100, align: 'right'},
            {field: 'yw_yufk', title: '预付款', width: 100, align: 'right'},
            {field: 'yw_yingfk', title: '应付款', width: 100, align: 'right'},
            {field: 'cgwjs_sl', title: '采购未结算数量', width: 100, align: 'right'},
            {field: 'cgwjs_je', title: '采购未结算金额', width: 100, align: 'right'},
            {field: 'wlwjs_je', title: '物流未结算金额', width: 100, align: 'right'},
            {field: 'cw_yufk', title: '预付款', width: 100, align: 'right'},
            {field: 'cw_yingfk', title: '应付款', width: 100, align: 'right'}
        ]
    ];

    var grid = $('#wlygyswl_grid').datagrid({
        url: $.webPath() + '/report/wlygyswl/wlygyswlList',
        toolbar: "#wlygyswl_toolbar",
        pagination: true,
        rownumbers: true,
        singleSelect: true,
        collapsible: true,
        fit: true,
        fitColumns: true,
        pageNumber: 1,
        showFooter: true,
        queryParams: {
            endDate: $("#wlygyswl_toolbar [name='endDate']").val()
        },
        onLoadSuccess: function () {
        },
        columns: columns
    });


//搜索按钮
    $("#wlygyswl_toolbar [name='searchButton']").click(function () {
        $(grid).datagrid({
            queryParams: {
                endDate: $("#wlygyswl_toolbar [name='endDate']").val(),
                gysMc: $("#wlygyswl_toolbar [name='gysMc']").val(),
                gsId: $("#wlygyswl_toolbar [name='gsId']").val()
            }});
    });


});


